Max is in a pie-eating contest that lasts 1 hour. Each torte that he eats takes 2 minutes. Each apple pie that he eats takes 3 minutes. He receives 4 points for each torte and 5 points for each pie. What should Max eat so as to get the most points? Solve the problem using the graphical method.
Solution:
Choose x,y as number of Tortes and number of Pies respectively.
Maximize 4x+5y
Constraints 2x+3y <=60
Graphical Method:
from IPython.display import Image
Image(filename='2.1.3.png')
from IPython.display import Image
Image(filename='2.1.1.png')
Therefore, we see that the points are maximized when Max eats 30 tortes; by doing this , he utilizes the entire 1 hour (30 2= 60 mins) and he gets 4 30 = 120 points, which can be proved even in R as shown above. If he would have spent the entire one hour having just pies, he would be able to eat 20 of them and score 20 * 5 = 100 points only. Thus the optimal solution would be (30,0)
Next, let's see what happens if he would like to stick to his preference of eating at least as many pies as tortes. That is; the number of pies he eats should be greater than or equal to the number of tortes. By how many points does this constraint decrease Max's total points?
Solution:
Now there is a new added constraint that y>=x i.e. x-y <= 0. Adding this new constraint to our A matrix, we get
from IPython.display import Image
Image(filename='2.1.2.png')
from IPython.display import Image
Image(filename='2.1.4.png')
Here we see that the objective value has lowered to 108 now and is thus 12 points lower than the first case which had one lesser constraint.
A farmer in Iowa owns 450 acres of land. He is going to plant each acre with wheat or corn. Each acre planted with wheat (corn) yields $2,000 ($3,000) profit, requires three (two) workers, and requires two (four) tons of fertilizer. There are currently 1,000 workers and 1,200 tons of fertilizer available.
Solution:
(a) Formulate the optimization problem and solve the problem graphically
Here choose x, y as numbers of acres grown with wheat and number of acres grown with corn respectively
Maximize 2000x + 3000y
Constraints
x+y <= 450;
3x+2y <= 1000;
2x+4y <= 1200
We have (200,200) as the optimal point
thus the objective function value is 400000+ 600000 = 1 million
from IPython.display import Image
Image(filename='2.2.3.png')
(b) Solve the problem in R and verify that the solutions are the same.
from IPython.display import Image
Image(filename='2.2.1.png')
(c) What happens to the decision variables and the total profit when the availability of fertilizer varies from 200 tons to 2200 tons in 100-ton increments? When does the farmer discontinue producing wheat? When does he stop producing corn?
from IPython.display import Image
Image(filename='2.2.2.png')
The farmer discontinues producing wheat when the availability of fertilizer increases to 1800 tons. He stops producing corn when the availability of fertilizer drops to 600 tons.
Star Oil wants to maximize the NPV that can be obtained by investing in investments 1-5. Formulate an LP that will help achieve this goal. Assume that any funds leftover at time 0 cannot be used at time 1.
Solution:
Choose x1, x2, x3, x4, x5 as the percentages of investments 1, 2, 3, 4 and 5 respectively.
Maximze the NPV i.e. 13x1 + 16x2 + 16x3 + 14x4 + 39x5
Constraints: Total investment in 1st year is 40 (in million) and in 2nd year is 20 (in million)
11x1 + 53x2 + 5x3 + 5x4 + 29x5 <= 40 ;
3x1 + 6x2 + 5x3 + x4 + 34x5 <= 20 ;
x1, x2, x3, x4, x5 <= 1
x1, x2, x3, x4, x5 >= 0
from IPython.display import Image
Image(filename='2.3.1.png')
Solving the above in R by plugging in values for c, matrix A and b (RHS of constraints) , we get the following solution:
Star Oil should invest 100% in Investment 1, 20.08% in Investment 2 (0.20086 * 53m), 100% in Investment 3, 100% in Investment 4 and 28.808% in Investment 5 to obtain maximum NPV of 57.45 million
Choose: x, y, z as servings of corn, milk and bread respectively
Minimize the cost i.e. 0.18x + 0.23y + 0.05z
Constraints: -72x - 121y - 65z <= 2000
72x + 121y + 65z <= 2250
-107x - 500y <= 5000
107x + 500y <= 50000
x, y, z <= 10
from IPython.display import Image
Image(filename='2.4.1.png')
The optimal solution for minimum cost is 1.94 servings of corn, 10 servings of milk, and 10 servings of bread.
The minimum cost is 3.15$
Paper and wood products companies need to define cutting schedules that will maximize the total wood yield of their forests over some planning period. Suppose that a firm with control of 2 forest units wants to identify the best cutting schedule over a planning horizon of 3 years. Forest unit 1 has a total acreage of 2 and unit 2 has a total of 3. The studies that the company has undertaken predict that each acre in unit 1(2) will have 1, 1.3, 1.4 (1, 1.2, 1.6) tons of woods available for harvesting in year 1, 2, 3 respectively. Based on its prediction of economic conditions, the company believes that it should harvest at least 1.2, 1.5, 2 tons of wood in year 1, 2, 3 separately. Due to the availability of equipment and personnel, the company can harvest at most 2, 2, 3 tons of wood in year 1, 2, 3. What is this company’s best cutting strategy that maximizes the total weights of wood? Here discounting of the time value should not be considered.
Solution:
Assumption: Here I have assumed that the 2 acres land is available in each of the three years. Since tons of wood available in 1 acre are given, I have multiplied it by 2 and 3 for Forest Unit 1 and 2 respectively. Also, minimum and maximum usage of wood in each year has been given which I have considered while forming my constraint equations.
from IPython.display import Image
Image(filename='2.5.1.png')
from IPython.display import Image
Image(filename='2.5.png')
Therefore, maximum tons of wood is 7 tons.
Wood in 1st unit in 1st year : 2 tons
Wood in 1st unit in 2nd year : 2 tons
Wood in 1st unit in 3rd year : 2.8 tons
Wood in 2nd unit in 1st year : 0 tons
Wood in 2nd unit in 2nd year : 0 tons
Wood in 2nd unit in 3rd year : 0.2 tons